<?php
/**
 * Author: ChenGuangHui
 * Email：13035809409@163.com
 * Date Time: 2021/7/8 10:09
 */


namespace App\Models\Official;


use App\Models\Model;

/**
 * App\Models\Official\Lexicon
 *
 * @property int $id
 * @property string $name 名称
 * @property bool $status
 * @property string $key
 * @property string $value
 * @property int $sort
 * @property \Illuminate\Support\Carbon|null $updated_at 修改时间
 * @property \Illuminate\Support\Carbon $created_at 添加时间
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon query()
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon whereKey($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon whereSort($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Lexicon whereValue($value)
 * @mixin \Eloquent
 */
class Lexicon extends Model
{
    protected $connection = 'store';

    protected $table = 'store_lexicon';

    protected $primaryKey = 'id';

    /**
     * @return bool
     */
    public function getStatusAttribute()
    {
        return $this->attributes['status'] = $this->attributes['status'] ? true : false;
    }

    /**
     * @return mixed
     */
    public function setStatusAttribute()
    {
        return $this->attributes['status'] = $this->attributes['status'] ? 1 : 0;
    }
}
